# -*- coding: UTF-8 -*-
# @author: rain_lane
# @email: 1172965673@qq.com
# @file: _15.py
# @time: 2021/6/12 13:41
# @Software: PyCharm


import requests
import time
import random
import pywasm


headers = {
    'Cookie': 'no-alert3=true; m=a63dfd5d9d08cc63c12e3799cfef6b7b|1623209868000; Hm_lvt_9bcbda9cbf86757998a2339a0437208e=1621677103,1621848443,1623204169,1623230113; Hm_lvt_c99546cf032aaa5a679230de9a95c7db=1621848415,1623204166,1623401859,1623464188; tk=3276842374183263298; sessionid=vif0d11wwi8t1dvzi65ifw6ujx10dbfv; Hm_lpvt_9bcbda9cbf86757998a2339a0437208e=1623477903; Hm_lpvt_c99546cf032aaa5a679230de9a95c7db=1623477928',
    'User-Agent': 'yuanrenxue.project'
}

session = requests.Session()

num = list()
for i in range(1, 6):
    t1 = int(time.time() / 2)
    t2 = int(t1 - random.random() * 50 + 1)
    vm_ = pywasm.load('main.wasm')
    m = vm_.exec('encode', [t1, t2])

    url = 'http://match.yuanrenxue.com/api/match/15'
    param_data = {
        'm': '{}|{}|{}'.format(m, t1, t2),
        'page': i,
    }

    res = requests.get(url=url, headers=headers, params=param_data).json()

    for i in res['data']:
        num.append(i['value'])

print(sum(num))
